package com.yeyks.commonReference.service.order;

import com.yeyks.common.ajax.AjaxResponseBody;
import com.yeyks.common.em.pay.PayTypeEnum;
import com.yeyks.order.dal.domain.OrderPayRecord;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yeyks.order.param.OrderPayRecordC2bCreateOrderPayRecordParam;
import org.springframework.transaction.annotation.Transactional;

import java.util.Map;


/**
 * <p>
 * 订单支付记录表 服务类
 * </p>
 *
 * @author yun
 * @since 2019-06-25
 */
public interface OrderPayRecordService extends IService<OrderPayRecord> {

    /**
     * 通过订单号查询支付对象
     *
     * @param orderNo
     * @return
     */
    OrderPayRecord selectOrderNo(String orderNo);

    /**
     * 根据回调结果更新支付信息
     *
     * @param orderPayRecord
     * @return
     */
    Integer update(OrderPayRecord orderPayRecord);


    /**
     * c2b生成订单支付记录:v3.3
     *
     * @param param
     * @return
     */
    AjaxResponseBody<Map<String, Object>> c2bCreateOrderPayRecord(OrderPayRecordC2bCreateOrderPayRecordParam param);

    /**
     * c2b订单支付回调处理:v3.3
     *
     * @param orderNo
     * @param payAttach
     * @param succeeded
     */
    void payCallback(String orderNo, PayTypeEnum payTypeEnum, Boolean succeeded);

    /**
     * 订单支付回调处理,事务包裹:v3.3
     * 该方法只做做事务增强,不提供调用
     *
     * @param orderNo
     * @param payTypeEnum
     * @param succeeded
     */
    @Transactional(rollbackFor = Exception.class)
    void payCallBackT(String orderNo, PayTypeEnum payTypeEnum, Boolean succeeded);

}
